<?php

/**
 +----------------------------------------------+
 * PHP Version 5.2.6                            *
 +----------------------------------------------+
 * 功能说明：
 +----------------------------------------------+
 * @Author    ：九九                            *
 * @QQ        ：405494897                       *
 * @Email     ：xjiujiu@foxmail.com             *
 * @Copyright ：2011/10/05                      *
 * @version   ：                                *
 * @package   ：                                *
 +----------------------------------------------+ 
**/

class Request {
    protected static $instance  = null;
    
    /**
     * 构造函数
     * 
     * @param null
     * @access public
     * @return void
     */
    private function __construct() {
        //some code
    }

    private function __clone() {
        //some code
    }

    public static function getInstance() {
        if(!(self::$instance instanceof self)) {
            self::$instance     = new self(); 
        }

        return self::$instance;
    }

    public function getRequest($element) {
        if(isset($_REQUEST[$element])) {
            return $_REQUEST[$element];
        }

        return null;
    }

    public function getPost($element) {
        if(isset($_POST[$element])) {
            return $_POST[$element];
        }

        return null;
    }

    public function getGet($element) {
        if(isset($_GET[$element])) {
            return $_GET[$element];
        }

        return null;
    }

    public function getPostByFilter($element) {
        return LittleTools::filterRequestData($this->getPost($element));
    }

    public function setRequest($keyName, $value) {
        if(!empty($keyName)) {
            $_REQUEST[$keyName]     = $value;
        } else {
            $_REQUEST[]             = $value;
        }
    }

}

?>
